import request from '@/utils/request'

export default {
  getPipeList(searchModel) {
    return request({
      url: '/pipe/list',
      method: 'get',
      params: {
        pipeName: searchModel.pipeName,
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  addPipe(pipe) {
    return request({
      url: '/pipe/add',
      method: 'post',
      data: pipe
    })
  },
  savePipe(pipe) {
    if (pipe.id == null || pipe.id === undefined) {
      return this.addPipe(pipe)
    }
    return this.updatePipe(pipe)
  },
  updatePipe(pipe) {
    return request({
      url: '/pipe/update',
      method: 'put',
      data: pipe
    })
  },
  getPipeById(id) {
    return request({
      // url: '/Pipe/' + id,
      url: `/pipe/${id}`,
      method: 'get'
    })
  },
  deletePipeById(id) {
    return request({
      url: `/pipe/delete/${id}`,
      method: 'delete'
    })
  },
  getAllPipeList() {
    return request({
      url: '/pipe/all',
      method: 'get'
    })
  },
}
